<?php

class Del implements Action {

  private $id;

  public function setParams($id = "") {
    $this->id = $id;
  }

  public function validate($response) {
    if ($this->id == "") {
      $response->addError("No id specified");
    }
  }

  public function execute($response) {
    $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(mysql_error());
    mysql_select_db(DB_NAME, $con) or die(mysql_error());
    $sql = "DELETE FROM clients WHERE client_id='$this->id'";
    mysql_query($sql, $con) or die(mysql_error());
  }

  public function getContentType() {
    return JSON;
  }

  public function getHTTPMethod() {
    return GET;
  }

}

?>
